package com.price.common.extend

import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Context.RECEIVER_EXPORTED
import android.content.Context.RECEIVER_NOT_EXPORTED
import android.content.Intent
import android.content.IntentFilter
import android.os.Build

@SuppressLint("UnspecifiedRegisterReceiverFlag")
/*RECEIVER_EXPORTED*/
fun Context.register(recerver: BroadcastReceiver, filter: IntentFilter, flag:Int?=0):Intent?{
    return if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.TIRAMISU) {
        registerReceiver(recerver, filter, if(flag==0) RECEIVER_EXPORTED else RECEIVER_NOT_EXPORTED)
    }else{
        registerReceiver(recerver, filter)
    }
}

